-- Viral Resistance - T-Engine 4 Module
-- Copyright (C) 2010 Mikolai Fajer
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program.  If not, see <http://www.gnu.org/licenses/>.
--
-- Mikolai Fajer "yufra"
-- mfajer@gmail.com

local Chat = require "engine.Chat"
local Talents = require("engine.interface.ActorTalents")

load("/data/general/npcs/humans.lua")
load("/data/general/npcs/humanoid_zombie.lua")
load("/data/general/npcs/misc.lua")

newEntity{ base = "BASE_NPC_HUMAN",
	name = "Chief of Virology", define_as = "CHIEF_OF_VIROLOGY",
	display = "d", color=colors.GOLD,
	desc = [[The chief of the virology department.]],
	level_range = {1, 4}, exp_worth = 1,
	can_talk = "code_green",
	on_die = function(self, who)
		if not game.player:isQuestStatus("start-doctor", engine.Quest.COMPLETED, "report") then
			game.player:setQuestStatus("start-doctor", engine.Quest.FAILED, "report")
		end
	end,
	unique = true,
	corpse = {name = "Corpse of the Chief of Virology.", color=colors.GOLD},
	mutation = false,
}

newEntity{ base = "BASE_NPC_HUMAN",
	name = "Chief of Medicine", define_as = "CHIEF_OF_MEDICINE",
	display = "d", color=colors.GOLD,
	desc = [[The chief of the hospital.]],
	level_range = {1, 4}, exp_worth = 1,
	unique = true,
	corpse = {name = "Corpse of the Chief of Medicine.", color=colors.GOLD,
		on_move = function(self, x, y, who)
			if who == game.player then
				-- Death-bed confession
				local chat = Chat.new("com_deathbed", self, who)
				chat:invoke()
				-- Then wipe the on_move
				self.on_move = nil
			end
		end,
	},
	mutation = false,
}

newEntity{ base = "BASE_NPC_ZOMBIE",
	name = "Spider Zombie", define_as = "SPIDER_ZOMBIE",
	display = "Z", color=colors.GOLD,
	desc = [[]],
	exp_worth = 1,
	combat = { dam=1, vdam=2},
	ai = "dumb_talented_simple",
	ai_state = {
		talent_in = 1,
		ai_target = "target_player",
		ai_move = "move_astar",
	},
	resolvers.talents{
		[Talents.T_SPIT]=1,
		[Talents.T_WEB_SPIT]=1,
		[Talents.T_STEALTH]=5,
		[Talents.T_STEALTH_LEAP]=1,
		[Talents.T_CLIMBING]=5,
	},
	resolvers.sustains_at_birth(),
	unique = true,
	corpse = {
		name = "Corpse of the spider zombie.",
		color=colors.GOLD,
	},
	mutation = false,
}

newEntity{ base = "SECURITY",
	define_as = "BARRIER_GUARD",
	rarity = false,
	mutation = false,
	ai_state = {ai_move = "move_nil"},
	can_talk = "armoury",
	-- Additional ammo
	resolvers.drops{nb=20,
		{type="ammo", subtype="clip", autoreq=true},
	},
}

newEntity{ base = "DOCTOR",
	define_as = "LAB_DOCTOR",
	rarity = false,
	mutation = false,
	ai_state = {ai_move = "move_nil"},
	can_talk = "lab_doctor",
}

newEntity{ base = "BASE_NPC_HUMAN",
	name = "Mechanic", define_as = "CONDUIT_MECHANIC",
	display = "m", color=colors.SANDY_BROWN,
	desc = [[A mechanic in overalls.]],
	level_range = {1, 4}, exp_worth = 1,
	unique = true,
	corpse = {
		name = "Corpse of a mechanic.",
		color=colors.SANDY_BROWN,
	},
	mutation = false,
	ai = "escort_quest",
}